home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / amiga / InputEvent.mod < prev    next >
Text File  |  1995-06-29  |  10KB  |  290 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: InputEvent.mod $
  4.   Description: input event definitions
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.8 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/04 23:13:14 $
  10.  
  11.   $VER: inputevent.h 36.10 (26.6.92)
  12.   Includes Release 40.15
  13.  
  14.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  15.       All Rights Reserved
  16.  
  17.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. ***************************************************************************)
  22.  
  23. <* STANDARD- *>
  24.  
  25. MODULE [2] InputEvent;
  26.  
  27. IMPORT e := Exec, u := Utility, t := Timer, g := Graphics, s := Sets;
  28.  
  29.  
  30. (* ----- constants --------------------------------------------------*)
  31.  
  32. CONST
  33.  
  34. (*  --- InputEvent.ieClass --- *)
  35. (* A NOP input event *)
  36.   null *                  = 00H;
  37. (* A raw keycode from the keyboard device *)
  38.   rawkey *                = 01H;
  39. (* The raw mouse report from the game port device *)
  40.   rawmouse *              = 02H;
  41. (* A private console event *)
  42.   event *                 = 03H;
  43. (* A Pointer Position report *)
  44.   pointerpos *            = 04H;
  45. (* A timer event *)
  46.   timer *                 = 06H;
  47. (* select button pressed down over a Gadget (address in ieEventAddress) *)
  48.   gadgetdown *            = 07H;
  49. (* select button released over the same Gadget (address in ieEventAddress) *)
  50.   gadgetup *              = 08H;
  51. (* some Requester activity has taken place.  See Codes REQCLEAR and REQSET *)
  52.   requester *             = 09H;
  53. (* this is a Menu Number transmission (Menu number is in ieCode) *)
  54.   menulist *              = 0AH;
  55. (* User has selected the active Window's Close Gadget *)
  56.   closewindow *           = 0BH;
  57. (* this Window has a new size *)
  58.   sizewindow *            = 0CH;
  59. (* the Window pointed to by ieEventAddress needs to be refreshed *)
  60.   refreshwindow *         = 0DH;
  61. (* new preferences are available *)
  62.   newprefs *              = 0EH;
  63. (* the disk has been removed *)
  64.   diskremoved *           = 0FH;
  65. (* the disk has been inserted *)
  66.   diskinserted *          = 10H;
  67. (* the window is about to be been made active *)
  68.   activewindow *          = 11H;
  69. (* the window is about to be made inactive *)
  70.   inactivewindow *        = 12H;
  71. (* extended-function pointer position report (V36) *)
  72.   newpointerpos *         = 13H;
  73. (* Help key report during Menu session (V36) *)
  74.   menuhelp *              = 14H;
  75. (* the Window has been modified with move, size, zoom, or change (V36) *)
  76.   changewindow *          = 15H;
  77.  
  78. (* the last class *)
  79.   classMax *              = 15H;
  80.  
  81.  
  82. (*  --- InputEvent.ieSubClass --- *)
  83. (*  NewPointerPos *)
  84. (*      like PointerPos *)
  85.   compatible * = 00H;
  86. (*      InputEvent.eventAddress points to PointerPixel) *)
  87.   pixel *      = 01H;
  88. (*      InputEvent.eventAddress points to PointerTablet) *)
  89.   tablet *     = 02H;
  90. (*      InputEvent.eventAddress points to NewTablet *)
  91.   newTablet *  = 03H;
  92.  
  93. TYPE
  94.  
  95.   IEDummyPtr * = POINTER TO IEDummy;
  96.   IEDummy * = RECORD END;
  97.  
  98. (* pointed to by InputEvent.eventAddress for classNewPointerPos,
  99.  * and subClassPixel.
  100.  *
  101.  * You specify a screen and pixel coordinates in that screen
  102.  * at which you'd like the mouse to be positioned.
  103.  * Intuition will try to oblige, but there will be restrictions
  104.  * to positioning the pointer over offscreen pixels.
  105.  *
  106.  * qualRelativeMouse is supported for subClassPixel.
  107.  *)
  108.  
  109.   PointerPixelPtr* = POINTER TO PointerPixel;
  110.   PointerPixel* = RECORD (IEDummy)
  111.     screen* : e.APTR;    (* Intuition.ScreenPtr *)
  112.                          (* pointer to an open screen *)
  113.     position* : g.Point; (* pixel coordinates in screen *)
  114.   END; (* PointerPixel *)
  115.  
  116. (* pointed to by InputEvent.eventAddress for classNewPointerPos,
  117.  * and subClassTablet.
  118.  *
  119.  * You specify a range of values and a value within the range
  120.  * independently for each of X and Y (the minimum value of
  121.  * the ranges is always normalized to 0).
  122.  *
  123.  * Intuition will position the mouse proportionally within its
  124.  * natural mouse position rectangle limits.
  125.  *
  126.  * qualRelativeMouse is not supported for subClassTablet.
  127.  *)
  128.  
  129.   PointerTabletPtr* = POINTER TO PointerTablet;
  130.   PointerTablet* = RECORD (IEDummy)
  131.     range * : g.Point;    (* 0 is min, these are max *)
  132.     value * : g.Point;    (* between 0 and Range *)
  133.     pressure * :INTEGER;  (* -128 to 127 (unused, set to 0) *)
  134.   END; (* PointerTablet *)
  135.  
  136.  
  137. (* The InputEvent.eventAddress of an classNewPointerPos event of subclass
  138.  * subClassNewTablet points at a NewTablet structure.
  139.  *
  140.  *
  141.  * qualRelativeMouse is not supported for subClassNewTablet.
  142.  *)
  143.  
  144.   NewTabletPtr * = POINTER TO NewTablet;
  145.   NewTablet * = RECORD (IEDummy)
  146.     (* Pointer to a hook you wish to be called back through, in
  147.      * order to handle scaling.  You will be provided with the
  148.      * width and height you are expected to scale your tablet
  149.      * to, perhaps based on some user preferences.
  150.      * If NULL, the tablet's specified range will be mapped directly
  151.      * to that width and height for you, and you will not be
  152.      * called back.
  153.      *)
  154.     callBack * :  u.HookPtr;
  155.  
  156.     (* Post-scaling coordinates and fractional coordinates.
  157.      * DO NOT FILL THESE IN AT THE TIME THE EVENT IS WRITTEN!
  158.      * Your driver will be called back and provided information
  159.      * about the width and height of the area to scale the
  160.      * tablet into.  It should scale the tablet coordinates
  161.      * (perhaps based on some preferences controlling aspect
  162.      * ratio, etc.) and place the scaled result into these
  163.      * fields.  The ient_ScaledX and ient_ScaledY fields are
  164.      * in screen-pixel resolution, but the origin ( [0,0]-point )
  165.      * is not defined.  The ient_ScaledXFraction and
  166.      * ient_ScaledYFraction fields represent sub-pixel position
  167.      * information, and should be scaled to fill a UWORD fraction.
  168.      *)
  169.     scaledX *, scaledY * : e.UWORD;
  170.     scaledXFraction *, scaledYFraction * :  e.UWORD;
  171.  
  172.     (* Current tablet coordinates along each axis: *)
  173.     tabletX *, tabletY * :  e.ULONG;
  174.  
  175.     (* Tablet range along each axis.  For example, if ient_TabletX
  176.      * can take values 0-999, ient_RangeX should be 1000.
  177.      *)
  178.     rangeX *, rangeY * :  e.ULONG;
  179.  
  180.     (* Pointer to tag-list of additional tablet attributes.
  181.      * See <intuition/intuition.h> for the tag values.
  182.      *)
  183.     tagList * : u.TagListPtr;
  184.   END;
  185.  
  186. CONST
  187.  
  188. (*  --- InputEvent.ieCode --- *)
  189. (*  rawKey *)
  190.   upPrefix *             = 80H;
  191.   keyCodeFirst *         = 00H;
  192.   keyCodeLast *          = 77H;
  193.   commCodeFirst *        = 78H;
  194.   commCodeLast *         = 7FH;
  195.  
  196. (*  ANSI *)
  197.   c0First *              = 00H;
  198.   c0Last *               = 1FH;
  199.   asciiFirst *           = 20H;
  200.   asciiLast *            = 7EH;
  201.   asciiDel *             = 7FH;
  202.   c1First *              = 80H;
  203.   c1Last *               = 9FH;
  204.   latin1First *          = 0A0H;
  205.   latin1Last *           = 0FFH;
  206.  
  207. (*  RawMouse *)
  208.   lButton *              = 68H;    (* also uses UpPREFIX *)
  209.   rButton *              = 69H;
  210.   mButton *              = 6AH;
  211.   noButton *             = 0FFH;
  212.  
  213. (*  Event (V36) *)
  214.   newActive *            = 01H;    (* new active input window *)
  215.   newSize *              = 02H;    (* resize of window *)
  216.   refresh *              = 03H;    (* refresh of window *)
  217.  
  218. (*  Requester *)
  219. (*      broadcast when the first Requester (not subsequent ones) opens up in *)
  220. (*      the Window *)
  221.   reqSet *               = 01H;
  222. (*      broadcast when the last Requester clears out of the Window *)
  223.   reqClear *             = 00H;
  224.  
  225.  
  226.  
  227. (*  --- InputEvent.ieQualifier --- *)
  228.   lShift *           = 0;
  229.   rShift *           = 1;
  230.   capsLock *         = 2;
  231.   control *          = 3;
  232.   lAlt *             = 4;
  233.   rAlt *             = 5;
  234.   lCommand *         = 6;
  235.   rCommand *         = 7;
  236.   numericPad *       = 8;
  237.   repeat *           = 9;
  238.   interrupt *        = 10;
  239.   multiBroadcast *   = 11;
  240.   midButton *        = 12;
  241.   rightButton *      = 13;
  242.   leftButton *       = 14;
  243.   relativeMouse *    = 15;
  244.  
  245. (* ----- InputEvent -------------------------------------------------*)
  246.  
  247. TYPE
  248.  
  249.   InputEventDummyPtr* = POINTER TO InputEventDummy;
  250.   InputEventDummy* = RECORD END;
  251.  
  252.   InputEventPtr* = POINTER TO InputEvent;
  253.   InputEvent* = RECORD (InputEventDummy)
  254.     nextEvent*  : InputEventDummyPtr; (* the chronologically next event *)
  255.     class *     : SHORTINT;  (* the input event class *)
  256.     subClass *  : SHORTINT;  (* optional subclass of the class *)
  257.     code *      : e.UWORD;   (* the input event code *)
  258.     qualifier*  : s.SET16;   (* qualifiers in effect for the event*)
  259.     x *         : INTEGER;   (* the pointer position for the event*)
  260.     y *         : INTEGER;
  261.     timeStamp * : t.TimeVal; (* the system tick at the event *)
  262.   END; (* InputEvent *)
  263.  
  264.   InputEventAdrPtr* = POINTER TO InputEventAdr;
  265.   InputEventAdr* = RECORD (InputEventDummy)
  266.     nextEvent*  : InputEventDummyPtr; (* the chronologically next event *)
  267.     class *     : SHORTINT;   (* the input event class *)
  268.     subClass *  : SHORTINT;   (* optional subclass of the class *)
  269.     code *      : e.UWORD;    (* the input event code *)
  270.     qualifier*  : s.SET16;    (* qualifiers in effect for the event*)
  271.     addr *      : IEDummyPtr;  (* the event address *)
  272.     TimeStamp * : t.TimeVal;  (* the system tick at the event *)
  273.   END; (* InputEventAdr *)
  274.  
  275.   InputEventPrevPtr* = POINTER TO InputEventPrev;
  276.   InputEventPrev* = RECORD (InputEventDummy)
  277.     nextEvent*      : InputEventDummyPtr; (* the chronologically next event *)
  278.     class *         : SHORTINT;   (* the input event class *)
  279.     subClass *      : SHORTINT;   (* optional subclass of the class *)
  280.     code *          : e.UWORD;    (* the input event code *)
  281.     qualifier*      : s.SET16;    (* qualifiers in effect for the event*)
  282.     prev1DownCode * : SHORTINT;   (* previous down keys for dead *)
  283.     prev1DownQual * : s.SET8;     (*   key translation: the ieCode *)
  284.     prev2DownCode * : SHORTINT;   (*   & low byte of ieQualifier for *)
  285.     prev2DownQual * : s.SET8;     (*   last & second last down keys *)
  286.     timeStamp *     : t.TimeVal;  (* the system tick at the event *)
  287.   END; (* InputEventPrev *)
  288.  
  289. END InputEvent.
  290.